package com.example.exam;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import java.util.ArrayList;
import java.util.List;

public class Main3Activity extends AppCompatActivity {

    private TextView fanghui;
    private TextView text2;
    private FragmentManager fm = getSupportFragmentManager();
    private FragmentTransaction ft;
    private List<Fragment> list = new ArrayList<>();
    private List<String> listStr = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        list.add(new Koq1Fragment());
        listStr.add("afhj");
        initView();
    }

    private void initView() {
        Intent intent = getIntent();
        int i = intent.getIntExtra("sign", 0);
        fanghui = (TextView) findViewById(R.id.fanghui);
        fanghui.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        text2 = (TextView) findViewById(R.id.text2);
        ft=fm.beginTransaction();
        ft.replace(R.id.uiF,list.get(i));
        text2.setText(listStr.get(i));
        ft.commit();
    }
}
